<%@ LANGUAGE="VBSCRIPT" %>
<%'  ------------------------------------------------------------
  '  viewer.asp 
  '  ------------------------------------------------------------
  '  VCS INFO:
  '  
  '  $Revision:   1.0  $
  '  $Date:   26 Jan 1998 18:20:04  $
  '  $Author:   CREED  $
  '  $Workfile:   mz_viewcontrols.asp  $
  '  ------------------------------------------------------------
  '  All Rights Reserved.  Copyright (c) 1988-1998 FileNET Corp.
  '  ------------------------------------------------------------
  '%>
<% RedirectToLogon = 1 %>
<!-- #include file="islogon.asp" -->



<% DocIDs = Request.QueryString("DocID")
if DocIDs = "" then
	DocIDs = Request.Form("DocID")
end if
LibraryLogonID = Session("LibraryLogonID")
set LibraryObj = Server.CreateObject("IDMObjects.Library")
LibraryObj.LogonID = LibraryLogonID

if DocIDs = "" then ' Nothing to view...
%>
<form name="control-panel" action="mz_view.asp" METHOD="GET">
<tr>
	<td align=left>
		<img src="images/ldoc.gif"><strong><font size=3>Please select the item(s) to view: <input name=DocID value=""><input type=submit value="View">
	</td>
</tr>
<% 
Response.End
end if
%>
<form name="control-panel" action="mz_viewcontrols.asp" METHOD="GET">
<table width=100%>
<tr>
	<td align=left>
		<img src="images/ldoc.gif"><strong><font size=3>
<%
pos1 = InStr(DocIDs, ",")
	if pos1 = 0 then
		DocID = DocIDs
		set DocObj = LibraryObj.GetObject(Application("idmObjTypeDocument"), DocID)
		Response.Write DocObj.ID
		Response.Write " : "
		Response.Write Server.HTMLEncode(DocObj.Label)
		%>		<input name="DocID" type="hidden" value="<%=DocObj.ID%>">
		<%
	else
%>
	<select name="DocID">
<%
		DocID = Mid(DocIDs, 1, pos1 - 1)
		set DocObj = LibraryObj.GetObject(Application("idmObjTypeDocument"), DocID)
%>
		<option value="<%=DocID%>"><%=DocID%>: <%=Server.HTMLEncode(DocObj.Label)%></option>
<%
		pos1 = pos1 + 2
		pos2 = InStr(pos1, DocIDs, ",")
		While pos2 > 0
			DocID2 = Mid(DocIDs, pos1, pos2 - pos1)
			On Error Resume Next
			set DocObj = LibraryObj.GetObject(Application("idmObjTypeDocument"), DocID2)
			if Len(Err.Description) = 0 then
%>
		<option value="<%=DocID2%>"><%=DocID2%>: <%=Server.HTMLEncode(DocObj.Label)%></option>
<%
				Response.Write "<p>"
					pos1 = pos2 + 2
				pos2 = InStr(pos1, DocIDs, ",")
			end if
		WEnd
		DocID2 = Right(DocIDs, Len(DocIDs) - pos1 + 1)		
		On Error Resume Next
		set DocObj = LibraryObj.GetObject(Application("idmObjTypeDocument"), DocID2)
		if Len(Err.Description) = 0 then
%>
		<option value="<%=DocID2%>"><%=DocID2%>: <%=Server.HTMLEncode(DocObj.Label)%></option>
<%
		end if
%>
	</select>
<%
	end if	
%>
		</font></strong>
	</td>
	<td align=right>
<%
	if pos1=0 then
		sTarget = DocObj.ID
	' now, the single item scripts
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function CheckinDocument()
{
  parent.location.href = "doccheckin.asp?DocID=<%=DocObj.ID%>&library=<%=Server.URLEncode(LibraryObj.Name)%>"
}

function CheckoutDocument()
{
  parent.location.href = "checkout.asp?Type=1&Ident=<%=DocObj.ID%>" // type of 1 is idmObjTypeDocument
}

function CancelCheckout()
{
  parent.location.href = "cancheckout.asp?Type=1&Ident=<%=DocObj.ID%>" // type of 1 is idmObjTypeDocument
}

function ShowProperty()
{
  parent.location.href = "property.asp?Type=1&Ident=<%=DocObj.ID%>" // type of 1 is idmObjTypeDocument
}

function ShowSecurity()
{
  parent.location.href = "security.asp?Ident=<%=DocObj.ID%>&type=1&library=<%=Server.URLEncode(LibraryObj.Name)%>" // type of 1 is idmObjTypeDocument
}
//-->
</SCRIPT>
<%
	else 
		sTarget = "the current selection"
	' the multiple item scripts
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function CheckinDocument()
{
  parent.location.href = "doccheckin.asp?DocID=<%=DocObj.ID%>&library=<%=Server.URLEncode(LibraryObj.Name)%>"
}

function CheckoutDocument()
{
  parent.location.href = "checkout.asp?Type=1&Ident=<%=DocObj.ID%>" // type of 1 is idmObjTypeDocument
}

function CancelCheckout()
{
  parent.location.href = "cancheckout.asp?Type=1&Ident=<%=DocObj.ID%>" // type of 1 is idmObjTypeDocument
}

function ShowProperty()
{
  parent.location.href = "property.asp?Type=1&Ident=<%=DocObj.ID%>" // type of 1 is idmObjTypeDocument
}

function ShowSecurity()
{
  parent.location.href = "security.asp?Ident=<%=DocObj.ID%>&type=1&library=<%=Server.URLEncode(LibraryObj.Name)%>" // type of 1 is idmObjTypeDocument
}
//-->
</SCRIPT>
<%
	end if
%>
		<input onClick="CheckoutDocument()" type=image src="images/ckin.gif" alt="checkin <%=sTarget%>"> 
		<input onClick="CheckinDocument()" type=image src="images/ckout.gif" alt="checkout <%=sTarget%>"> 
		<input onClick="CancelCheckout()" type=image src="images/canckout.gif" alt="cancel checkout for <%=sTarget%>">
		<input onClick="ShowSecurity()" type=image src="images/lockbut.gif" alt="security for <%=sTarget%>"> 
		<input onClick="ShowProperty()" type=image src="images/prop2.gif" alt="properties for <%=sTarget%>"> 
		<input onClick="ViewSecurity()" type=image src="images/pagez.gif" alt="view the current selection"> 
	</td>
</tr>
</table>
</form>
